/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package cse308.entities;

import java.io.Serializable;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Aaron
 */
@Entity
@Table(catalog = "nchorn", schema = "")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Targetattainmentlevel.findAll", query = "SELECT t FROM Targetattainmentlevel t"),
    @NamedQuery(name = "Targetattainmentlevel.findBySemester", query = "SELECT t FROM Targetattainmentlevel t WHERE t.targetattainmentlevelPK.semester = :semester"),
    @NamedQuery(name = "Targetattainmentlevel.findByAttainmentlevel", query = "SELECT t FROM Targetattainmentlevel t WHERE t.attainmentlevel = :attainmentlevel"),
    @NamedQuery(name = "Targetattainmentlevel.findByPeo", query = "SELECT t FROM Targetattainmentlevel t WHERE t.targetattainmentlevelPK.peo = :peo")})
public class Targetattainmentlevel implements Serializable {
    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected TargetattainmentlevelPK targetattainmentlevelPK;
    private Integer attainmentlevel;
    @JoinColumn(name = "peo", referencedColumnName = "identifier", nullable = false, insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private Peo peo1;

    public Targetattainmentlevel() {
    }

    public Targetattainmentlevel(TargetattainmentlevelPK targetattainmentlevelPK) {
        this.targetattainmentlevelPK = targetattainmentlevelPK;
    }

    public Targetattainmentlevel(String semester, String peo) {
        this.targetattainmentlevelPK = new TargetattainmentlevelPK(semester, peo);
    }

    public TargetattainmentlevelPK getTargetattainmentlevelPK() {
        return targetattainmentlevelPK;
    }

    public void setTargetattainmentlevelPK(TargetattainmentlevelPK targetattainmentlevelPK) {
        this.targetattainmentlevelPK = targetattainmentlevelPK;
    }

    public Integer getAttainmentlevel() {
        return attainmentlevel;
    }

    public void setAttainmentlevel(Integer attainmentlevel) {
        this.attainmentlevel = attainmentlevel;
    }

    public Peo getPeo1() {
        return peo1;
    }

    public void setPeo1(Peo peo1) {
        this.peo1 = peo1;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (targetattainmentlevelPK != null ? targetattainmentlevelPK.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Targetattainmentlevel)) {
            return false;
        }
        Targetattainmentlevel other = (Targetattainmentlevel) object;
        if ((this.targetattainmentlevelPK == null && other.targetattainmentlevelPK != null) || (this.targetattainmentlevelPK != null && !this.targetattainmentlevelPK.equals(other.targetattainmentlevelPK))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "cse308.entities.Targetattainmentlevel[ targetattainmentlevelPK=" + targetattainmentlevelPK + " ]";
    }
    
}
